<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.jamwiki.model.*,org.jamwiki.*" %> 
<%@ include file="include.jsp"%>
<%
List tlist = WikiBase.getDataHandler().getAllRoles();
Map temp = new HashMap();
if(tlist.size()>0){
    for(int i = 0;i<tlist.size();i++){
        Role r = (Role)tlist.get(i);
        temp.put(r.getAuthority(),r.getDescription());
    }
}
String userId = request.getParameter("userId");
WikiUser user = WikiBase.getDataHandler().lookupWikiUser(Integer.parseInt(userId),null);
Role[] rlist = WikiBase.getDataHandler().getRoleMapUser(user.getUsername());
Map userRole = new HashMap();
if(null != rlist && rlist.length>0){
    for(int j = 0;j<rlist.length;j++){
        Role r = rlist[j];
        userRole.put(r.getAuthority(),r.getDescription()); 
    }
} 
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>wiki">
    <title>韶关移动知识维客管理系统-授权管理</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page"> 
  </head>
  <body  leftmargin="0"  topmargin="0"  marginwidth="0" marginheight="0">
   <table width="98%" height="15" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
        </table>
        <form action="<%=request.getContextPath() %>/wiki/doRole.jsp" method="post" name="form1">
   <table width="98%"  border="0"  align="center" cellpadding="0" cellspacing="1" bgcolor="#dddddd"> 
         <tr class="table-tr2">
            <td align="center" height="10" colspan=4>授权管理</td> 
          </tr> 
   			<tr class="table-tr1">
   			<input type="hidden" name="userId" value="<%=userId %>"/>
             <td align="center">帐号</td>
            <td align="center"><%=user.getUsername() %></td>
            <td align="center">姓名</td>
            <td align="center"><%=user.getDisplayName() %></td>  
          </tr> 
          <tr class="table-tr2">
            <td align="center" colspan=2>选择</td>
            <td align="center" colspan=2>角色</td> 
          </tr> 
          <tr class="table-tr1">
            <td align="center" colspan=2><input type="checkbox" name="userRole" value="ROLE_ADMIN" <%if(null != userRole.get("ROLE_ADMIN")){out.println(" checked");} %>></td>
            <td align="center" colspan=2><%=temp.get("ROLE_ADMIN")%></td> 
          </tr> 
          <!--  <tr class="table-tr1">
            <td align="center" colspan=2><input type="checkbox" name="userRole" value="ROLE_EDIT_EXISTING" <%if(null != userRole.get("ROLE_EDIT_EXISTING")){out.println(" checked");} %>></td>
            <td align="center" colspan=2><%=temp.get("ROLE_EDIT_EXISTING")%></td> 
          </tr> -->
          <tr class="table-tr1">
            <td align="center" colspan=2><input type="checkbox" name="userRole" value="ROLE_EDIT_NEW" <%if(null != userRole.get("ROLE_EDIT_NEW")){out.println(" checked");} %>></td>
            <td align="center" colspan=2><%=temp.get("ROLE_EDIT_NEW")%></td> 
          </tr>  <!--
          <tr class="table-tr1">
            <td align="center" colspan=2><input type="checkbox" name="userRole" value="ROLE_MOVE" <%if(null != userRole.get("ROLE_MOVE")){out.println(" checked");} %>></td>
            <td align="center" colspan=2><%=temp.get("ROLE_MOVE")%></td> 
          </tr> -->
          <tr  >
            <td align="right" colspan=2><input type="submit"   value="确定"></td>
            <td align="left" colspan=2><input  type="button" onclick="window.close();"  value="取消"></td> 
          </tr> 
           
        </table>
        </form>
        
  </body>
</html>
